package com.zoe.wan.android.example.activity.knowledge

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.zoe.wan.android.example.repositry.Repository
import com.zoe.wan.android.example.repositry.data.knowledge.KnowledgeDetialData
import com.zoe.wan.base.BaseViewModel
import kotlinx.coroutines.launch

class FragDetailListViewModel(application: Application): BaseViewModel(application) {

    var mydata = MutableLiveData<KnowledgeDetialData>()

    fun getDetailData(cid:String,callback:(KnowledgeDetialData)->Unit){
        viewModelScope.launch {
            val data = Repository.knowledgeListDetail("1",cid)
            data?.let {
                callback.invoke(it)
//                mydata.postValue(it)
            }
        }
    }



}